<?php 
$mail =  mysql_real_escape_string($_POST['mail']);
$phone = mysql_real_escape_string($_POST['phone']);
$fax = mysql_real_escape_string($_POST['fax']);
$add = mysql_real_escape_string($_POST['add']);

if(isset($_POST['updatecon']))

{
 $sql="UPDATE contact_settings  SET `email` = '".$mail."',`phone`='".$phone."',`faxno`='".$fax."',
		`address`='".$add."' where id='".$_POST['hid']."'";

mysql_query($sql);
$ssql="update administration set Email='".$mail."'";
mysql_query($ssql);

echo "<script>window.location='index.php?tc=contact_set&_s=1'</script>";
	
}

?>
<?php if($_REQUEST['_s'] == 1){ ?>
    <div class="sucmsg"><img src="images/information.png" align="absmiddle" />&nbsp;Successfully saved.</div>
<?php } ?>

<?php 

 $ssql="select * from contact_settings";
$ssql=mysql_query($ssql);
$row =mysql_fetch_array($ssql);
?>
<form name="up" action="#" method="post">
<table width="99%" align="center" border="0"  class="list" cellpadding="5">
<input type="hidden" name="hid" value="<?php echo  $row['id'];?>" />
<thead>
<tr>
	<td colspan="2" align="left">
        <div style="float:left" class="righthead">Contact Settings</div>
        
    </td>
</tr>
</thead>
<tr>

    <td align="left"  valign="top" width="20%">
    	Contact Mail</td>
        <td><textarea name="mail" id="mail" style="width:462px; " ><?php echo $row['email'];?></textarea>
  

    </td>
</tr>
<tr>

    <td align="left"  valign="top" width="20%">
    	Contact phone</td>
        <td>
   <input type="text" name="phone" style="width:300px; height:30px;" value="<?php echo $row['phone'];?>" />
    </td>
</tr>
<tr>

    <td align="left"  valign="top" width="20%">
    	Fax</td>
        <td> <input type="text" name="fax" style="width:300px; height:30px;" value="<?php echo $row['faxno'];?>" />
  

    </td>
</tr>
<tr>

    <td align="left"  valign="top" width="20%">
    	Contact Address</td>
        <td><textarea name="add" id="add" style="width:462px; height:100px; " ><?php echo $row['address'];?></textarea>
  

    </td>
</tr>

<tr>
	<td colspan="2" style="padding-left:195px;">
    	
          <input type="submit" value="Update" name="updatecon" >
         
        
    </td>
</tr>        
</table>   
</form> 
